<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
</head>

<body>
    <header class="aui-bar aui-bar-nav" style="background-color: #03a9f4;position:fixed;" id="header">
        <a class="aui-pull-left aui-btn" tapmode onclick="closeWin();">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title" id="title">
            涂装下线确认
        </div>
    </header>
    <div class="aui-content aui-margin-b-15" style="margin-top:50px;">
        <ul class="aui-list aui-form-list">

            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">滑橇号</div>
                    <input type="text" class="aui-input" placeholder="请输入滑橇号" style="width: 80%;font-size: 16px;"
                        id="skiddingCode" />
                    <div class="aui-btn aui-btn-info" style="width:25% ;margin-right:2%;" onclick="checkSkidding()">
                        开始确认</div>
                </div>
            </li>

        </ul>

        <ul class="ui-selectee" id="tbodyHtml">

        </ul>

        <p></p>
        <p></p>
        <div style="height:60px;"></div>

    </div>


</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript" src="../script/public.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
    //光标所在id
    //光标所在id
    var idSelector = "";


    var seqNo = ""
    var flag = "";
    var arrSave = [];
    var num = 0;
    var mrlnum = 0;
    //初始化查询仓库下拉框
    apiready = function () {
        search()
    }
    function search() {
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/getSkiddingOnlinePlan";
        var data = {
            values: { ////以表单方式提交参数（JSON对象）
                state: "2",
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                if (myobj.code == '0') {
                    var list = eval(myobj.list);
                    var html = "";
                    if (list != null && list.length > 0) {
                        $("#skiddingCode").val(list[0].skiddingCode)
                    } else {
                        $("#skiddingCode").val("")
                        api.toast({
                            msg: "不存在需要确认的涂装上线计划！",
                            duration: 3000
                        });
                
                    }

                } else {
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            }
        });
    }
    //校验滑橇
    function checkSkidding() {
        var skiddingCode = $("#skiddingCode").val();
        var un = localStorage.getItem('un');
        var serverUrl = localStorage.getItem('serverUrl');
        var url = serverUrl + "/app/checkSkiddingOnlinePlanConfirm";
        var data = {
            values: { ////以表单方式提交参数（JSON对象）
                skiddingCode: skiddingCode,
                un: un
            }
        };
        api.ajax({
            url: url,
            method: 'post',
            dataType: 'json',
            timeout: 300,
            returnAll: false,
            data: data
        }, function (ret, err) {
            if (ret) {
                var data = JSON.stringify(ret);
                var myobj = eval("(" + data + ")");
                if (myobj.code == '0') {
                    seqNo = myobj.seqNo
                    flag = myobj.flag
                    startBind(flag, seqNo, skiddingCode)
                } else {
                    api.toast({
                        msg: myobj.message,
                        duration: 3000
                    });
                }
            }
        });
    }
    function startBind(flag, seqNo, skid) {
        if (flag == "1") {
            api.openWin({
                name: 'skiddingOfflineSeq',
                url: 'skiddingOfflineSeq.html',
                pageParam: {
                    skiddingCode: skid,
                    seq: seqNo,
                    name: "skiddingOffline"
                }
            });
        } else {
            api.openWin({
                name: 'skiddingOfflineLot',
                url: 'skiddingOfflineLot.html',
                pageParam: {
                    skiddingCode: skid,
                    seq: seqNo,
                    name: "skiddingOffline"
                }
            });
        }
    }
    //返回按钮
    function closeWin() {
        api.closeWin({});
    }
</script>

</html>